/*-------------------------------------
 * about.js
 * 
 * Manage About Page
 */

var ImportPage = new Class ({

	Extends:  GHTPage,
	
	initialize: function() {
		this.parent("Import");
		curImportName = "";
		
		this.submitImport();
	},
	
	submitImport: function() {
		form = $('adminImport');
		
		form.iFrameFormRequest({ 
            onComplete: function(response) {
            	var tagtst = />(.*)</;
            	json = tagtst.test(response) ? JSON.decode(tagtst.exec(response)[1]) : response
            	
            	$$log(json);
            			
            	new Element('tr',{
            		text: json['file_status'] + curImportName + ' ($1 records)'.$$(json['row_count']),
            	}).inject($('importtable'));
            }
        });
	},
	
	setFilename: function(txt) {
		curImportName = txt.split("\\")[2];
	}
});

//-------------------------------------------
//Show time!
window.addEvent('domready', function(){
	// starting small
	ghtPage = new ImportPage();
});